/**
 * Copyright 2010 Adam Ruggles.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package saig.engine.models.enums;

/**
 * TODO comment
 * @author Adam
 * @version $Id$
 * 
 * Created on Aug 10, 2010 at 10:27:23 PM 
 */
public enum ModelType {
	BULLET_BILL(4),
	FLOWER(2),
	GOOMBA(5),
	JUMPING_PIRANHA_PLANT(6),
	KOOPA_TROOPA(7),
	PLAYER(1),
	MUSHROOM(3),
	SPINY(8),
	SHELL(9),
	FLAG(10);
    /**
	 * Returns a ModelType from it's integer value.
	 * @param value The value of the model type.
	 * @return A ModelType from it's integer value.
	 */
	public static ModelType fromInt(final int value) {    
		switch(value) {
            case 1:
            	return PLAYER;
            case 2:
            	return FLOWER;
            case 3:
            	return MUSHROOM;
            case 4:
            	return BULLET_BILL;
            case 5:
            	return GOOMBA;
            case 6:
            	return JUMPING_PIRANHA_PLANT;
            case 7:
            	return KOOPA_TROOPA;
            case 8:
            	return SPINY;
            case 9:
            	return SHELL;
            case 10:
            	return FLAG;
            default:
            	return null;
        }
	}
    /**
     * The model integer value.
     */
    private final int value;
	/**
     * Constructs a Model Type.
     * @param value The model integer value.
     */
    private ModelType(int value) {
    	this.value = value;
    }
	/**
	 * Returns the integer value of the tile type.
	 * @return The integer value of the tile type.
	 */
	public int toInt() {
		return value;
	}
	/**
	 * Returns a string representation of the model type.
	 * {@inheritDoc}
	 * @see java.lang.Enum#toString()
	 */
	public String toString() {
		switch(this) {
		case PLAYER:
			return "Player";
		case FLOWER:
			return "Flower";
		case MUSHROOM:
			return "Mushroom";
		case BULLET_BILL:
			return "Bullet Bill";
		case GOOMBA:
			return "Goomba";
		case JUMPING_PIRANHA_PLANT:
			return "Piranha Plant";
		case KOOPA_TROOPA:
			return "Koopa Troopa";
		case SPINY:
			return "Spiny";
		case SHELL:
			return "Shell";
		case FLAG:
			return "End Flag";
		default:
			return "Unkown";
		}
	}
}
